home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Windows Expert
/
Windows Expert.iso
/
program
/
owldlgs.zip
/
DLGNOPAR.CPP
< prev
next >
Wrap
C/C++ Source or Header
|
1992-01-12
|
3KB
|
67 lines
/**********************************************************************/
/* Dlgnopar.cpp by Bob Bourbonnais */
/* released to the public domain 12/16/91 */
/* This program demonstrates a dialog box */
/* with a menu and two buttons that can call a non-modal */
/* dialog box with out a parent from either the menu or a button */
/* A non-modal dialog box will not keep control. You can go */
/* to other windows while it is open. A non-modal dialog box */
/* without a parent becomes its own main window dialog box. */
/* If another window gets the focus, a non-modal without a parent */
/* will go behind the window with the focus. */
/**********************************************************************/
#include <owl.h>
#include <dialog.h>
#include "dlgnopar.h"
class TDialog6Dialog : public TDialog // Dialog class to add
{ // processing for menu and
public: // button selections
TDialog6Dialog(LPSTR lpName) // constructor calls
:TDialog(NULL,lpName) {}; // base class constructor
virtual void HandleMenuItem(RTMessage Msg) // menu handler
= [CM_FIRST + IDM_NON_MODAL_DIALOG];
virtual void HandleButtonMessage(RTMessage Msg) // button handler
= [ID_FIRST + IDB_NON_MODAL_DIALOG]; // close button handled by
}; // base class button handler
void TDialog6Dialog:: HandleMenuItem(RTMessage)
{
GetApplication()->MakeWindow(new TDialog(NULL,"Non_Modal_Dialog_Box"));
} // MakeWindow activates a non-modal dialog box
// the null qualifier makes it parentless.
void TDialog6Dialog:: HandleButtonMessage(RTMessage)
{
GetApplication()->MakeWindow(new TDialog(NULL,"Non_Modal_Dialog_Box"));
}
class TDialog6App : public TApplication // Application Class to contain
{ // the application
public:
TDialog6App(LPSTR lpName, HANDLE hInstance, // constructor calls the
HANDLE hPrevInstance, // base class constructor
LPSTR lpCmdLine, int nCmdShow)
:TApplication(lpName, hInstance,
hPrevInstance,
lpCmdLine, nCmdShow) {};
virtual void InitMainWindow(); // overrides base class InitMainWindow
};
void TDialog6App::InitMainWindow() // to initialize a dialog box
{ // as the main window
MainWindow = new TDialog6Dialog("Main_Window_Dialog");
} // using message processing provided
// by derived class
int PASCAL WinMain(HANDLE hInstance, // main entry point from
HANDLE hPrevInstance, // windows to this program
LPSTR lpCmdLine , int nCmdShow)
{
TDialog6App Dialog6("Dialog Tester",hInstance, // create instance of
hPrevInstance, // the dialog application
lpCmdLine,nCmdShow);
Dialog6.Run(); // run it
return (Dialog6.Status); // exit
}
/**********************************************************************/